//
//  ChangeSalerPicturViewModel.m
//  YIJU2.0HD
//
//  Created by URANUS on 16/5/26.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "ChangeSalerPicturViewModel.h"
#import "PersonCenterViewController.h"
#import "SyncTimer.h"
#import "UIAlertControllerUtil.h"

@implementation ChangeSalerPicturViewModel
- (void)manager:(NetworkingBaseManager *)manager callAPIDidSuccessWithParams:(NSDictionary *)responseParams {
    if (self.finishPicturBlock != nil) {
        _finishPicturBlock();
        if ([responseParams[@"stateCode"] integerValue] != 100) {
            [UIAlertControllerUtil generateInfoControllerWithTitle:@"温馨提示"
                                                           message:responseParams[@"stateMessage"]];
        }
    }
}


- (void)loadRequest {
    self.manager = [NetworkingManagerFactory generateSHA256Manager];
    RequestGenerator *generator = [RequestGenerator sharedInstance];
    self.manager.apiName = [generator generateCommonApiWithName:[NSString stringWithFormat:@"salers/%ld/lifePhoto",[AppContext sharedInstance].userId]];
    self.manager.avatarFileName = @"lifePhoto";
    self.manager.postImage = _uploadImage;
    self.manager.requestType = HTTP_UPLOAD;
    self.manager.successDelegate = self;
    self.manager.validator = self;
    [self.manager loadRequest];
}

@end
